import uuid

# 城市编码映射关系
city_code_map = {
    '固原': '1001Z01000000000SIJA',
    '石嘴山': '1001Z01000000000SIIY',
    '中卫': '1001Z01000000000SIJH',
    '银川': '1001Z01000000000SIIQ',
    '吴忠': '1001Z01000000000SIJ3'
}

area_code_map = {
    '固原': '1001Z01000000000SIJB',
    '石嘴山': '1001Z01000000000SIIZ',
    '中卫': '1001Z01000000000SIJI',
    '银川': '1001Z01000000000SIIR',
    '吴忠': '1001Z01000000000SIJ4'
}

# 每个城市对应的五个坐标点
coordinates = {
    '固原': [
        '106.254321,35.723456', '106.478901,35.881234', '106.598765,35.934567',
        '106.145678,35.695432', '106.601234,35.912345'
    ],
    '石嘴山': [
        '106.523456,38.712345', '106.409876,38.698765', '106.734567,38.934567',
        '106.395678,38.605432', '106.843210,38.687654'
    ],
    '中卫': [
        '105.192345,37.504567', '105.176543,37.487654', '105.413456,37.723456',
        '105.087654,37.612345', '105.368765,37.834567'
    ],
    '银川': [
        '106.283456,38.475678', '106.167890,38.456789', '106.507654,38.796789',
        '106.056789,38.687654', '106.496543,38.465432'
    ],
    '吴忠': [
        '106.523456,37.475678', '106.307890,37.356789', '106.747654,37.796789',
        '106.216789,37.687654', '106.636543,37.365432'
    ]
}

# 生成医院名称的前缀
hospital_prefixes = ['测试第二十一医院', '测试第二十二医院', '测试第二十三医院', '测试第二十四医院', '测试第二十五医院']

# SQL模板
sql_template = """
INSERT INTO MEDEX_MCPC.ORG_ORGS (
    PK_ORG, PK_PARENT, PK_GROUP, COUNTRYZONE, CREATOR, MODIFIER, CODE, NAME, SHORTNAME, 
    PK_INDUSTRY, ENSHORT, ENABLESTATE, INTRODUCTION, MEMO, CREATETIME, MODIFIEDTIME, DR, TS, 
    PRINCIPAL, MOBILE, HOMEPHONE, EMAIL, DEF1, DEF2, DEF3, DEF4, DEF5, DEF6, DEF7, DEF8, DEF9, 
    DEF10, DEF11, DEF12, DEF13, DEF14, DEF15, DEF16, DEF17, DEF18, DEF19, DEF20, ORG_ADDRESS, 
    ORG_GRADE, ORG_FILEPATH, ORG_FILENAME, JIUZHI_NENGLI_PINGGU, ORG_PROVINCE, ORG_CITY, 
    ORG_AREA, XT_ZHONGXIN_BANBEN
) VALUES (
    '{}', '0001A0100000004MHG9J', '1001', NULL, '老院长', '老院长', '{}', '{}', NULL, NULL, NULL, 1, 
    NULL, NULL, '2025-02-25 17:14:36', '2025-02-27 15:49:08', 0, '2025-02-27 15:49:08', NULL, 
    NULL, NULL, NULL, '{}', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 
    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,NULL, '1', NULL, NULL, '456', 
    '1001Z01000000000SIIP', '{}', '{}', '2'
);
"""

# 主键计数器
pk_org_counter = 4000

# 输出SQL语句
for city, coords in coordinates.items():
    for i, coord in enumerate(coords):
        pk_org_counter += 1
        code = f"0{i + 1:03d}"
        name = f"{city}{hospital_prefixes[i]}"
        org_city = city_code_map[city]
        area_code =area_code_map[city]

        print(sql_template.format(
            f'1001A01D000000{pk_org_counter}', code, name, coord, org_city, area_code
        ))